package com.hifar.test.archive.controller;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import com.hifar.base.serialNo.pojo.BaseSerialNo;
import com.hifar.base.serialNo.service.IBaseSerialNoService;
import com.hifar.test.archive.pojo.HfEnvArchive;
import com.hifar.test.archive.service.IHfEnvArchiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hifar.config.AsyncConfig;
import com.hifar.fw.utils.id.IdUtils;
import com.hifar.fw.utils.lang.DateUtils;
import com.hifar.fw.utils.lang.StringUtils;
import com.hifar.fw.utils.lang.UrlUtils;
import com.hifar.plat.baseModal.pojo.BaseOssFiles;
import com.hifar.plat.baseModal.service.IBaseOssFilesService;
import com.hifar.plat.officUtil.ExcelTemplateUtil;
import com.hifar.sys.BusiResponse;
import com.hifar.sys.MinioUtil;
import com.hifar.sys.PageResult;
import com.hifar.sys.RequestConver;
import com.hifar.sys.SystemLoginUser;
import com.hifar.sys.SystemUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * 文件管理 前端控制器 default
 * </p>
 *
 * @author wangkepeng
 * @since 2024-12-09 15:10:00
 */
@RestController
@RequestMapping("/api/busi/test/hfEnvArchiveController")
@Api(tags = "文件管理功能")
public class HfEnvArchiveController {

	@Autowired
	private IHfEnvArchiveService hfEnvArchiveService;

	@Autowired
	private IBaseOssFilesService baseOssFilesService;

	@Autowired
	private IBaseSerialNoService baseServiceNoService;

	@Autowired
	private AsyncConfig asynConfig;

	@PostMapping(value = "/list")
	@ApiOperation(value = "文件管理功能:分页查询列表")
	public BusiResponse list(HttpServletRequest request) {
		Map<String, Object> pageInfo = RequestConver.getPageInfo(request);
		QueryWrapper<HfEnvArchive> queryWrapper = RequestConver.getPostParam(pageInfo);
		queryWrapper.ne("del_flag", 1);
		queryWrapper.orderByDesc("create_time");
		String pid = StringUtils.trimNull(pageInfo.get("pid"));
		if (!pid.equals("")) {
			queryWrapper.eq("pid", pid);
		}
		String archiveViewType = StringUtils.trimNull(pageInfo.get("archiveViewType"));
		if (!archiveViewType.equals("")) {
			queryWrapper.eq("archive_view_type", archiveViewType);
		}
		String fileType = StringUtils.trimNull(pageInfo.get("fileType"));
		if (!fileType.equals("")) {
			queryWrapper.eq("file_type", fileType);
		}
		queryWrapper.in("secret_level", SystemLoginUser.dataSecretSet);
		if (queryWrapper != null && pageInfo.size() > 0) {
			Page<HfEnvArchive> page = new Page<>((Integer) pageInfo.get("pageNo"), (Integer) pageInfo.get("pageSize"));
			Page<HfEnvArchive> page1 = hfEnvArchiveService.page(page, queryWrapper);
			page1.getRecords().forEach(item -> {
				item.setSearchFlag(null);
				item.setSearchFlagPath(null);
			});

			convertFileResult(page1.getRecords());
			/* 计算分页信息返回给前端 */
			PageResult pageResult = SystemUtil.parsePage(page, page1);
			return BusiResponse.OK(pageResult);
		} else {
			return BusiResponse.error("参数不正确！");
		}
	}

	public int getMaxSequenceNo() {
		int serial_no = 0;
		QueryWrapper<BaseSerialNo> queryWrapper = new QueryWrapper<>();
		queryWrapper.lambda().eq(BaseSerialNo::getType, "HF_ENV_ARCHIVE").eq(BaseSerialNo::getYearDay, 0);
		BaseSerialNo baseSerialNo = baseServiceNoService.getOne(queryWrapper);
		if (Objects.nonNull(baseSerialNo)) {
			Integer serialNo = baseSerialNo.getSerialNo();
			serial_no = serialNo + 1;
			baseSerialNo.setSerialNo(serial_no);
			baseServiceNoService.updateById(baseSerialNo);
		} else {
			serial_no = 1;
			baseSerialNo = new BaseSerialNo();
			baseSerialNo.setSerialNo(serial_no);
			baseSerialNo.setType("HF_ENV_ARCHIVE");
			baseSerialNo.setYearDay("0");
			baseServiceNoService.save(baseSerialNo);
		}

		return serial_no;
	}

	@PostMapping(value = "/listAll")
	@ApiOperation(value = "文件管理功能:查询列表(不带分页)")
	public BusiResponse listAll(HttpServletRequest request) {
		QueryWrapper<HfEnvArchive> queryWrapper = new QueryWrapper<>();
		queryWrapper.orderByDesc("create_time");
		Map<String, Object> pageInfo = RequestConver.getPageInfo(request);
		String pid = StringUtils.trimNull(pageInfo.get("pid"));

		queryWrapper.ne("del_flag", 1);
		if (!pid.equals("")) {
			queryWrapper.eq("pid", pid);
		}
		String archiveViewType = StringUtils.trimNull(pageInfo.get("archiveViewType"));
		if (!archiveViewType.equals("")) {
			queryWrapper.eq("archive_view_type", archiveViewType);
		}
		String fileType = StringUtils.trimNull(pageInfo.get("fileType"));
		if (!fileType.equals("")) {
			queryWrapper.eq("file_type", fileType);
		}
		String keyword = StringUtils.trimNull(pageInfo.get("keyword"));
		if (!fileType.equals("")) {
			queryWrapper.like("file_name", keyword);
		}

		queryWrapper.in("secret_level", SystemLoginUser.dataSecretSet);
		List<HfEnvArchive> list = hfEnvArchiveService.list(queryWrapper);

		convertFileResult(list);
		list.forEach(item -> {
			item.setSearchFlag(null);
			item.setSearchFlagPath(null);
		});
		if (list != null && list.size() > 0) {
			return BusiResponse.OK(list);
		} else {
			return BusiResponse.ok("没有查询到数据！");
		}
	}

	@PostMapping(value = "/add")
	@ApiOperation(value = "文件管理功能:新增")
	public BusiResponse add(@RequestBody HfEnvArchive archive) {
		System.out.println("=========111========add");

		int searchFlagNo = 1;
		int levelNum = -1;
		searchFlagNo = getNotExistsSerialNo();
		archive.setSearchFlag(searchFlagNo);

		// 统计文件标记 1是excel统计文件0不是excel统计文件
		archive.setStatisticExcel(0);
		// 文件类型：1 文件夹 2 文件
		Integer fileType = archive.getFileType();
		BaseOssFiles ossFile = null;
		if (fileType.intValue() == 2) {
			ossFile = baseOssFilesService.getById(archive.getFileId());
			if (ossFile == null) {
				return BusiResponse.error("根据fileId查询文件,未查询到!");
			} else {
				copyProperty(ossFile, archive);
			}
		}

		String pid = archive.getPid();
		String searchFlagPath = "";
		if ("0".equals(pid)) {
			searchFlagPath = "0_" + searchFlagNo + "_";
			levelNum = 1;
		} else {
			// 父对象
			HfEnvArchive parentArchive = hfEnvArchiveService.getById(pid);
			if (parentArchive != null) {
				searchFlagPath = parentArchive.getSearchFlagPath() + searchFlagNo + "_";
				levelNum = parentArchive.getLevelNum() + 1;
			} else {
				BusiResponse.error(String.format("父id为%s的类未查询到，请检查参数", pid));
			}
		}
		archive.setLevelNum(levelNum);
		archive.setSearchFlagPath(searchFlagPath);
		archive.setUpdateUserId(SystemLoginUser.userId);
		archive.setUpdateUserName(SystemLoginUser.idName);
		archive.setUpdateTime(new Date());
		hfEnvArchiveService.save(archive);
		// 同步一级的归档excel文件
		SyncProduceExcelByObject(archive);

		return BusiResponse.ok("添加成功");
	}

	@PostMapping(value = "/addBatch")
	@ApiOperation(value = "文件管理功能:新增")
	public BusiResponse addBatch(@RequestBody List<HfEnvArchive> archiveList) {
		HfEnvArchive archiveOne = null;
		for (HfEnvArchive archive : archiveList) {
			archiveOne = archive;

			int searchFlagNo = 1;
			int levelNum = -1;
			searchFlagNo = getNotExistsSerialNo();
			archive.setSearchFlag(searchFlagNo);

			// 统计文件标记 1是excel统计文件0不是excel统计文件
			archive.setStatisticExcel(0);
			// 文件类型：1 文件夹 2 文件
			Integer fileType = archive.getFileType();
			BaseOssFiles ossFile = null;
			if (fileType.intValue() == 2) {
				ossFile = baseOssFilesService.getById(archive.getFileId());
				if (ossFile == null) {
					return BusiResponse.error("根据fileId查询文件,未查询到!");
				} else {
					copyProperty(ossFile, archive);
				}
			}

			String pid = archive.getPid();
			String searchFlagPath = "";
			if ("0".equals(pid)) {
				searchFlagPath = "0_" + searchFlagNo + "_";
				levelNum = 1;
			} else {
				// 父对象
				HfEnvArchive parentArchive = hfEnvArchiveService.getById(pid);
				if (parentArchive != null) {
					searchFlagPath = parentArchive.getSearchFlagPath() + searchFlagNo + "_";
					levelNum = parentArchive.getLevelNum() + 1;
				} else {
					BusiResponse.error(String.format("父id为%s的类未查询到，请检查参数", pid));
				}
			}
			archive.setLevelNum(levelNum);
			archive.setSearchFlagPath(searchFlagPath);
			archive.setUpdateUserId(SystemLoginUser.userId);
			archive.setUpdateUserName(SystemLoginUser.idName);
			archive.setUpdateTime(new Date());
			hfEnvArchiveService.save(archive);

		}
		if (archiveOne != null) {
			// 同步一级的归档excel文件
			SyncProduceExcelByObject(archiveOne);
		}
		return BusiResponse.ok("添加成功");
	}

	public HfEnvArchive getArchiveBySearchFlag(String searchFlag) {
		HfEnvArchive archive = null;
		QueryWrapper<HfEnvArchive> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("search_flag", searchFlag);
		queryWrapper.ne("del_flag", "1");
		archive = hfEnvArchiveService.getOne(queryWrapper, false);
		return archive;
	}

	// 同步某个分类的一级归档excel的信息
	private void SyncProduceExcelByObject(HfEnvArchive archive) {
		asynConfig.getAsyncExecutor().execute(() -> {
			String searchFlagPath = archive.getSearchFlagPath();
			String searchFlag1 = null;
			HfEnvArchive archiveLevel1 = null;
			if (!"".equals(searchFlagPath)) {
				String[] arr = searchFlagPath.split("_");
				if (arr.length > 1) {
					searchFlag1 = arr[1];
				}
				// 第一级searchFlag1不为空
				if (searchFlag1 != null) {
					archiveLevel1 = getArchiveBySearchFlag(searchFlag1);
				}
				if (archiveLevel1 != null) {
					produceExcelByLevel1Archive(archiveLevel1);
				}
			}

		});
	}

	/*
	 * 根据一级分类的信息，生成一级的excel归档文件
	 */
	private void produceExcelByLevel1Archive(HfEnvArchive archiveLevel1) {
		String path = hfEnvArchiveService.generateLevel1Excel(archiveLevel1);
		// 查询归档exce是否存在start
		QueryWrapper<HfEnvArchive> queryWrapper = new QueryWrapper<>();
		queryWrapper.orderByDesc("create_time");
		queryWrapper.eq("statisic_excel", "1");
		queryWrapper.eq("pid", archiveLevel1.getId());
		List<HfEnvArchive> list = hfEnvArchiveService.list(queryWrapper);
		HfEnvArchive statisticObj = null;
		if (list != null && list.size() > 0) {
			statisticObj = list.get(0);
		}
		String minioBucket;
		String minioPath;
		String localFilePath = path;
		double fileSize = 0;
		File file = new File(path);
		if (file.exists()) {
			fileSize = file.length();
		}
		String fileName = "归档说明.xlsx";
		String fileNameToSave = path.substring(path.lastIndexOf("\\"));
		if (File.separator.equals("\\")) {
			fileNameToSave = path.substring(path.lastIndexOf("\\") + 1);
		} else {
			fileNameToSave = path.substring(path.lastIndexOf("/") + 1);
		}

		// 存在修改，不存在新增
		if (statisticObj != null) {
			minioBucket = statisticObj.getBucketName();
			minioPath = statisticObj.getFilePath();
			String chartPath = UrlUtils.joinUrl("/hifar/archive", DateUtils.getPathDate(new Date())) + "/"
					+ fileNameToSave;
			try {
				MinioUtil.uploadLocalFileToMinio(minioBucket, chartPath, localFilePath);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			statisticObj.setFileName(fileName);
			statisticObj.setFileType(2);
			statisticObj.setFilePath(chartPath);
			statisticObj.setUpdateUserId(SystemLoginUser.userId);
			statisticObj.setUpdateUserName(SystemLoginUser.idName);
			statisticObj.setUpdateTime(new Date());
			statisticObj.setFileSize(fileSize);
			hfEnvArchiveService.updateById(statisticObj);

			// 增加ossfile数据
			BaseOssFiles ossFile = new BaseOssFiles();
			ossFile.setFileSize(fileSize);
			ossFile.setId(statisticObj.getFileId());
			ossFile.setFilePath(chartPath);
			ossFile.setFileName(fileName);
			ossFile.setFileSize(fileSize);
			ossFile.setUpdateUserId(SystemLoginUser.userId);
			ossFile.setUpdateUserName(SystemLoginUser.idName);
			ossFile.setUpdateTime(new Date());
			baseOssFilesService.updateById(ossFile);

		} else {

			int searchFlagNo = 1;
			int levelNum = -1;
			searchFlagNo = getNotExistsSerialNo();
			String searchFlagNoStr = Integer.toHexString(searchFlagNo);
			minioBucket = "public";
			minioPath = "archive";

			String chartPath = UrlUtils.joinUrl("/hifar/archive", DateUtils.getPathDate(new Date())) + "/"
					+ fileNameToSave;
			try {
				MinioUtil.uploadLocalFileToMinio(minioBucket, chartPath, localFilePath);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			String fileId = IdUtils.uuid32();
			statisticObj = new HfEnvArchive();
			statisticObj.setFileSize(fileSize);
			statisticObj.setId(IdUtils.uuid32());
			statisticObj.setFileType(2);
			statisticObj.setStatisticExcel(1);
			statisticObj.setBucketName(minioBucket);
			statisticObj.setBucketPre(minioBucket);
			statisticObj.setFilePath(chartPath);
			statisticObj.setViewType("application/vnd.ms-excel");
			statisticObj.setArchiveViewType(2);
			statisticObj.setFileName(fileName);
			statisticObj.setFileSize(fileSize);
			statisticObj.setPid(archiveLevel1.getId());
			statisticObj.setSearchFlag(searchFlagNo);
			String searchFlagPath = "";
			if ("0".equals(archiveLevel1.getId())) {
				searchFlagPath = "0_" + searchFlagNoStr + "_";
				levelNum = 1;
			} else {
				if (archiveLevel1 != null) {
					searchFlagPath = archiveLevel1.getSearchFlagPath() + searchFlagNoStr + "_";
					levelNum = archiveLevel1.getLevelNum() + 1;
				}
			}
			statisticObj.setSearchFlagPath(searchFlagPath);
			statisticObj.setLevelNum(levelNum);
			statisticObj.setFileId(fileId);
			statisticObj.setCreateUserId(SystemLoginUser.userId);
			statisticObj.setCreateUserName(SystemLoginUser.idName);
			statisticObj.setCreateTime(new Date());
			statisticObj.setUpdateUserId(SystemLoginUser.userId);
			statisticObj.setUpdateUserName(SystemLoginUser.idName);
			statisticObj.setUpdateTime(new Date());

			hfEnvArchiveService.save(statisticObj);

			// 增加ossfile数据
			BaseOssFiles ossFile = new BaseOssFiles();
			ossFile.setFileSize(fileSize);
			ossFile.setId(fileId);
			ossFile.setBucketName(minioBucket);
			ossFile.setBucketPre(minioBucket);
			ossFile.setFilePath(chartPath);
			ossFile.setViewType("application/vnd.ms-excel");
			ossFile.setFileName(fileName);
			ossFile.setFileSize(fileSize);
			ossFile.setCreateUserId(SystemLoginUser.userId);
			ossFile.setCreateUserName(SystemLoginUser.idName);
			ossFile.setCreateTime(new Date());
			ossFile.setUpdateUserId(SystemLoginUser.userId);
			ossFile.setUpdateUserName(SystemLoginUser.idName);
			ossFile.setUpdateTime(new Date());
			baseOssFilesService.save(ossFile);
		}

		// 查询归档exce是否存在end
		System.out.println(path);

	}

	private void copyProperty(BaseOssFiles ossFile, HfEnvArchive archive) {
		archive.setBucketName(ossFile.getBucketName());
		archive.setBucketPre(ossFile.getBucketPre());
		archive.setFileName(ossFile.getFileName());
		archive.setChunkCount(ossFile.getChunkCount());
		archive.setFileMd5(ossFile.getFileMd5());
		archive.setViewType(ossFile.getViewType());
		archive.setFileSize(ossFile.getFileSize());
		archive.setPartSize(ossFile.getPartSize());
		archive.setFilePath(ossFile.getFilePath());
	}

	/*
	 * 获取数据库中不重复的serialNo
	 */
	public int getNotExistsSerialNo() {
		int serial_no;
		serial_no = this.getMaxSequenceNo();
		QueryWrapper<HfEnvArchive> queryWrapper = new QueryWrapper<>();
		queryWrapper.eq("SEARCH_FLAG", serial_no);
		List<HfEnvArchive> list = hfEnvArchiveService.list(queryWrapper);
		while (list != null && list.size() > 0) {
			serial_no = this.getMaxSequenceNo();
			queryWrapper = new QueryWrapper<>();
			queryWrapper.eq("SEARCH_FLAG", serial_no);
			list = hfEnvArchiveService.list(queryWrapper);
		}
		return serial_no;
	}

	@PostMapping(value = "/edit")
	@ApiOperation(value = "文件管理功能:编辑")
	public BusiResponse edit(@RequestBody HfEnvArchive archive1) {

		HfEnvArchive archive = new HfEnvArchive();
		archive.setId(archive1.getId());
		archive.setUpdateUserId(SystemLoginUser.userId);
		archive.setUpdateUserName(SystemLoginUser.idName);
		archive.setUpdateTime(new Date());
		archive.setFileName(archive1.getFileName());
		archive.setRemarks(archive1.getRemarks());
		archive.setRowSort(archive1.getRowSort());
		hfEnvArchiveService.updateById(archive);

		// 生成第一级的归档excel文件
		HfEnvArchive newArchive = hfEnvArchiveService.getById(archive1.getId());
		SyncProduceExcelByObject(newArchive);

		return BusiResponse.ok("编辑成功！");
	}

	@GetMapping("/queryById")
	@ApiOperation(value = "文件管理功能:根据id查询数据")
	public BusiResponse queryById(@RequestParam(name = "id") String id) {
		HfEnvArchive byId = hfEnvArchiveService.getById(id);
		byId.setSearchFlag(null);
		byId.setSearchFlagPath(null);

		convertFileResult(byId);
		// 查询转换附件
		return BusiResponse.OK(byId);
	}

	@PostMapping("/delete")
	@ApiOperation(value = "文件管理功能:逻辑删除")
	public BusiResponse delete(@RequestBody List<String> idList) {

		// todo:如果删除的是文件夹，文件夹下有文件则不能删除。

		QueryWrapper<HfEnvArchive> queryWrapper = new QueryWrapper<>();
		queryWrapper.in("id", idList);
		List<HfEnvArchive> objList = hfEnvArchiveService.list(queryWrapper);
		for (HfEnvArchive obj : objList) {
			if (obj.getFileType() == 1) {
				queryWrapper = new QueryWrapper<>();
				queryWrapper.like("search_flag_path", obj.getSearchFlagPath());
				queryWrapper.ne("id", obj.getId());
				queryWrapper.ne("STATISIC_EXCEL", 1);
				int count = hfEnvArchiveService.count(queryWrapper);
				if (count > 0) {
					return BusiResponse.error(400, "目录[" + obj.getFileName() + "]中存在文件，请先删除文件！");
				}
			}
		}

		List<HfEnvArchive> archiveListTodo = new ArrayList<HfEnvArchive>();
		QueryWrapper<HfEnvArchive> delete = new QueryWrapper<>();
		delete.in("id", idList);
		hfEnvArchiveService.remove(delete);

		Set<String> level1IdSet = new HashSet<String>();
		String searchPath = null;
		String level1Id = null;
		for (HfEnvArchive archive : objList) {
			searchPath = archive.getSearchFlagPath();
			String[] arr = searchPath.split("_");
			if (arr.length > 1) {
				level1Id = arr[1];
				if (!level1IdSet.contains(level1Id)) {
					archiveListTodo.add(archive);
					level1IdSet.add(level1Id);
				}
			}
		}
		for (HfEnvArchive archive : archiveListTodo) {
			// 生成第一级的归档excel文件
			SyncProduceExcelByObject(archive);
		}

		return BusiResponse.ok("删除成功！");
	}

	@PostMapping("/exportExcel")
	@ApiOperation(value = "文件管理功能:导出数据")
	public Object exportExcel(HttpServletRequest request) {
		Map<String, Object> pageInfo = RequestConver.getPageInfo(request);
		if (pageInfo == null) {
			return BusiResponse.error("参数有误！");
		}
		BusiResponse export = hfEnvArchiveService.exportExcel(pageInfo);
		if (export.getCode() == com.hifar.fw.utils.bean.BusiConst.CODE_SUCCESS) {
			String encode = null;
			try {
				encode = URLEncoder.encode("文件管理.xlsx", "UTF-8");
			} catch (UnsupportedEncodingException e) {
				e.printStackTrace();
			}
			HttpHeaders headers = new HttpHeaders();
			headers.add("Content-Type", "application/vnd.ms-excel");
			headers.add("Access-Control-Expose-Headers", "Content-Disposition");
			headers.add("Content-Disposition", "filename=" + encode);
			return ResponseEntity.status(HttpStatus.OK).headers(headers).body((byte[]) export.getData());
		}
		return export;
	}

	@PostMapping("/importExcel")
	@ApiOperation(value = "文件管理功能:导入excel数据")
	public BusiResponse importExcel(@RequestParam("file") MultipartFile file) throws Exception {
		if (file.isEmpty()) {
			return BusiResponse.error("文件为空！");
		} else {
			if (ExcelTemplateUtil.isExcelFile(file)) {
				return hfEnvArchiveService.importExcel(file);
			} else {
				return BusiResponse.error("请上传excel文件！");
			}
		}
	}

	public static void convertFileResult(List<HfEnvArchive> dataList) {
		if (dataList != null && dataList.size() > 0) {

			for (HfEnvArchive archive : dataList) {
				convertFileResult(archive);
			}
		}
	}

	protected static void convertFileResult(HfEnvArchive dataMap) {
		int fileType = dataMap.getFileType();
		if (dataMap != null && fileType == 2) {
			String bucketPre = dataMap.getBucketName();
			String fileName = dataMap.getFileName();// StringUtils.trimNull(dataMap.get("fileName"));
			String filePath = dataMap.getFilePath();// StringUtils.trimNull(dataMap.get("filePath"));
			String previewPath = MinioUtil.getFullFilePathStatic(bucketPre, filePath);
			String downloadPath = MinioUtil.getDownloadPathStatic(bucketPre, filePath, fileName);
			dataMap.setFullFilePath(previewPath);
			dataMap.setViewPath(MinioUtil.getViewPath(bucketPre, filePath, fileName));
			dataMap.setDownloadPath(downloadPath);
		}

	}

}